package ar.org.cfired.creditos.parametros;

import java.util.Iterator;
import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.Transaction;

import ar.org.cfired.hibernate.utils.HibernateUtil;

public class PruebaBancos {
	public static void main (String args[]) {
		String provincia = "SF";
		
		
    	Session session = HibernateUtil.getSessionFactory().getCurrentSession();
		Transaction t = session.beginTransaction();
		//SQLQuery q = session.createSQLQuery(sql);
		try {
			List<Banco> listaBancos= (List<Banco>)session.createQuery("from Banco where Ban_Provincia='" + provincia + "'").list();
			Iterator<Banco> bancos = listaBancos.iterator();
			Banco bancoActual = null;
			while (bancos.hasNext()) {
				bancoActual = bancos.next();
				System.out.println(bancoActual.getBanNombre());
			}
			
			List<UEP> listaUEPs= (List<UEP>)session.createQuery("from UEP where Uep_Provincia='" + provincia + "'").list();
			Iterator<UEP> ueps = listaUEPs.iterator();
			UEP uepActual = null;
			while (ueps.hasNext()) {
				uepActual = ueps.next();
				System.out.println(uepActual.getUepUbicacion());
			}
						
			
			
			t.rollback();
			
		}
		catch (HibernateException e){
			System.err.println(e.toString());
		}		

	}
}
